package com.yanqu.road.web.controller.game.sort;

import com.yanqu.road.entity.player.UserInfo;

import java.util.Comparator;

public class UserInfoEarnSpeedSort implements Comparator<UserInfo> {

    private String orderBy = "asc";

    public UserInfoEarnSpeedSort() {
    }

    public UserInfoEarnSpeedSort(String orderBy) {
        this.orderBy = orderBy;
    }

    @Override
    public int compare(UserInfo o1, UserInfo o2) {
        if("asc".equals(orderBy)){
            return o1.getEarnSpeed().compareTo(o2.getEarnSpeed());
        }
        return o2.getEarnSpeed().compareTo(o1.getEarnSpeed());
    }
}
